<?php
	class Character_model extends CI_Model {
		public function __construct() {
			parent::__construct();
		}
		
		public function getUserStats($id) {
			$query = $this->db->query('SELECT * FROM characters WHERE ID = ' . $id);
			$result = $query->result_array();
			$result = $result[0];
			
			return $result;
		}
		
		public function getAllShops() {
			$query = $this->db->query('SELECT * FROM shops');
			$result = $query->result_array();

			return $result;
		}
		
		public function getZoneStats($id) {
			$query = $this->db->query('SELECT * FROM zones WHERE ID = ' . $id);
			$result = $query->result_array();
			$result = $result[0];
			
			return $result;
		}
		
		public function getShopItems($id) {
			$query = $this->db->query('SELECT * FROM shop_items WHERE shop_id = ' . $id);
			$result = $query->result_array();
			
			return $result;
		}
		
		public function getItemStats($id) {
			$query = $this->db->query('SELECT * FROM items WHERE ID = ' . $id);
			$result = $query->result_array();
			$result = $result[0];
			
			return $result;
		}
		
		public function getShopStats($id) {
			$query = $this->db->query('SELECT * FROM shops WHERE ID = ' . $id);
			$result = $query->result_array();
			$result = $result[0];
			
			return $result;
		}
		
		public function getUserInventory($id) {
			$query = $this->db->query('SELECT * FROM character_inventory WHERE char_id = ' . $id);
			$result = $query->result_array();
			
			return count($result) == 0 ? null : $result;
		}
	}
?>